package com.sgb.kjwl.viewmodel.self.packers;

import android.view.Gravity;
import android.view.View;

import androidx.core.content.ContextCompat;

import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
import com.bigkoo.pickerview.view.OptionsPickerView;
import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.config.PictureConfig;
import com.luck.picture.lib.config.PictureMimeType;
import com.sgb.kjwl.AppConstant;
import com.sgb.kjwl.R;
import com.sgb.kjwl.api.APIManager;
import com.sgb.kjwl.api.NewAPIManager;
import com.sgb.kjwl.model.entity.packers.BuildCompanyInfoEntity;
import com.swgk.core.base.api.ICallBack;
import com.swgk.core.base.model.entity.H5ReEntity;
import com.swgk.core.util.PickSelectEntity;
import com.sgb.kjwl.model.entity.self.SelfTeamIntroduceEntity;
import com.sgb.kjwl.model.entity.transport.MapLongAndLatEntity;
import com.sgb.kjwl.model.entity.user.AddressEntity;
import com.sgb.kjwl.model.entity.user.ServiceEntity;
import com.sgb.kjwl.repository.SelfRepertory;
import com.sgb.kjwl.utils.GlideEngine;
import com.sgb.kjwl.view.ui.activity.self.packers.SelfTeamIntroduceActivity;
import com.sgb.kjwl.view.widget.TeamMultiPopWindow;
import com.swgk.core.base.BaseViewModel;
import com.swgk.core.base.model.entity.BaseEntity;
import com.swgk.core.dialog.DialogHelper;
import com.swgk.core.util.MLog;
import com.swgk.core.util.MToast;

import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import okhttp3.MediaType;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * @author WYJ
 * @date 2020/8/27
 */
public class SelfTeamIntroduceModel extends BaseViewModel implements TeamMultiPopWindow.FilterResultClick, TeamMultiPopWindow.IItemClick {

    private SelfRepertory mRepertory;
    private SelfTeamIntroduceActivity mActivity;
    private TeamMultiPopWindow mPopWindow;

    /**
     * 地址选择器
     */
    private OptionsPickerView<PickSelectEntity> mCityOptions;
    private List<PickSelectEntity<List<PickSelectEntity>>> mOpt;
    /**
     * 省
     */
    private final List<PickSelectEntity> mOpt1 = new ArrayList<>();
    /**
     * 市
     */
    private final List<List<PickSelectEntity>> mOpt2 = new ArrayList<>();
    private int opt1;
    private int opt2;
    private int gdType;

    /**
     * 咨询客服
     */
    private OptionsPickerView<PickSelectEntity> mCustomerOptions;
    private List<PickSelectEntity> mServiceList = new ArrayList<>();

    /**
     * 工队类型
     */
    private OptionsPickerView<PickSelectEntity> mTeamTypeOptions;
    private List<PickSelectEntity> mTeamTypeList = new ArrayList<>();


    public SelfTeamIntroduceModel(SelfTeamIntroduceActivity mActivity, SelfRepertory mRepertory) {
        this.mRepertory = mRepertory;
        this.mActivity = mActivity;
    }

    public void pictureSelector() {
        PictureSelector.create(mActivity)
                .openGallery(PictureMimeType.ofImage())
                .loadImageEngine(GlideEngine.createGlideEngine())
                .theme(R.style.picture_default_style)
                .selectionMode(PictureConfig.MULTIPLE)
                .compress(true)
                .minimumCompressSize(10240)
                .maxSelectNum(1)
                .forResult(PictureConfig.CHOOSE_REQUEST);
    }

    public void CooperationBusinessLicenseSelector() {
        PictureSelector.create(mActivity)
                .openGallery(PictureMimeType.ofImage())
                .loadImageEngine(GlideEngine.createGlideEngine())
                .theme(R.style.picture_default_style)
                .selectionMode(PictureConfig.SINGLE)
                .compress(true)
                .minimumCompressSize(10240)
                .maxSelectNum(1)
                .forResult(AppConstant.BUSINESS_LICENSE);

    }

    public void affiliatedUnitPic() {
        PictureSelector.create(mActivity)
                .openGallery(PictureMimeType.ofImage())
                .selectionMode(PictureConfig.SINGLE)
                .loadImageEngine(GlideEngine.createGlideEngine())
                .theme(R.style.picture_default_style)
                .compress(true)
                .minimumCompressSize(10240)
                .maxSelectNum(1)
                .forResult(AppConstant.AFFILIATED_PIC);

    }

    public void rvCooperationFileList(int i) {
        PictureSelector.create(mActivity)
                .openGallery(PictureMimeType.ofImage())
                .selectionMode(PictureConfig.MULTIPLE)
                .loadImageEngine(GlideEngine.createGlideEngine())
                .theme(R.style.picture_default_style)
                .compress(true)
                .minimumCompressSize(10240)
                .maxSelectNum(i)
                .forResult(AppConstant.COOPERATION_FILE);

    }

    /**
     * 上传头像
     *
     * @param file
     * @param completeNum
     * @param type
     */
    public void uploadAvatarFileModel(File file, int completeNum, int type) {
        Map<String, RequestBody> photos = new HashMap<>();
        RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
        photos.put("file" + "\"; filename=\"" + completeNum + "image.jpg\"", requestBody);
        DialogHelper.showProgressDialog(mActivity, null, "头像上传中" + "...", 0, false, null).setCanceledOnTouchOutside(false);
        APIManager.getInstance().getUploadAPI().uploadFile(photos).enqueue(new Callback<BaseEntity>() {
            @Override
            public void onResponse(@NotNull Call<BaseEntity> call, @NotNull Response<BaseEntity> response) {
                DialogHelper.dismissProgressDialog();
                if (response.body() == null || response.body().getState() == null) {
                    MToast.showToast(mActivity, "上传失败！");
                    DialogHelper.dismissProgressDialog();
                    return;
                }
                if (response.body().getState().equals(APIManager.RESPONSE_OK)) {
                    mActivity.uploadAvatarResult(response.body().getData().toString(), type);
                } else {
                    MToast.showToast(mActivity, "上传失败！");
                    DialogHelper.dismissProgressDialog();
                }
            }

            @Override
            public void onFailure(@NotNull Call<BaseEntity> call, @NotNull Throwable t) {
                DialogHelper.dismissProgressDialog();
                MToast.showToast(mActivity, "上传失败！" + t.getMessage());
            }
        });
    }

    public void addTeamInfo(SelfTeamIntroduceEntity entity) throws IllegalAccessException {
        Map<String, Object> map = new HashMap<>();
        Class<?> clazz = entity.getClass();
        for (Field field : clazz.getDeclaredFields()) {
            field.setAccessible(true);
            String fieldName = field.getName();
            Object value = field.get(entity);
            if ("categoryNo1".equals(fieldName)) {
                fieldName = "categoryNo";
            }

            if ("businessAddressStr".equals(fieldName)) {
                fieldName = "businessAddress";
            }

            if ("principalHometownStr".equals(fieldName)) {
                fieldName = "principalHometown";
            }

            if ("affBusinessAddressStr".equals(fieldName)) {
                fieldName = "affBusinessAddress";
            }

            if (value == null) {
                value = "";
            }

            if (!"businessScopes".equals(fieldName)){
                map.put(fieldName, value);
            }
        }
        DialogHelper.showProgressDialog(mActivity, null, "数据加载中...", 0, false, null).setCanceledOnTouchOutside(false);
        NewAPIManager.getInstance().getTeamNewInterfaceAPI().addTeamInfo(map).enqueue(new Callback<BaseEntity<Object>>() {
            @Override
            public void onResponse(@NotNull Call<BaseEntity<Object>> call, @NotNull Response<BaseEntity<Object>> response) {
                DialogHelper.dismissProgressDialog();
                if (response.body() == null || response.body().getState() == null) {
                    MToast.showToast(mActivity, "发布失败！");
                    return;
                }
                if (response.body().getState().equals(AppConstant.REQEUST_SECCUESS)) {
                    mActivity.editEntitySuccess();
                } else {
                    assert response.body() != null;
                    MToast.showToast(mActivity, response.body().getMsg());
                }
            }

            @Override
            public void onFailure(@NotNull Call<BaseEntity<Object>> call, @NotNull Throwable t) {
                DialogHelper.dismissProgressDialog();
                MToast.showToast(mActivity, "发布失败！" + t.getMessage());
            }
        });
    }

    public void getCityData(boolean isShow) {
        DialogHelper.showProgressDialog(mActivity, null, "数据加载中...", 0, false, null).setCanceledOnTouchOutside(false);
        APIManager.getInstance().getUserAPI().getLocateList().enqueue(new Callback<BaseEntity<List<PickSelectEntity<List<PickSelectEntity>>>>>() {
            @Override
            public void onResponse(@NotNull Call<BaseEntity<List<PickSelectEntity<List<PickSelectEntity>>>>> call, @NotNull Response<BaseEntity<List<PickSelectEntity<List<PickSelectEntity>>>>> response) {
                DialogHelper.dismissProgressDialog();
                if ("200".equals(response.body().getCode())) {
                    mOpt = response.body().getData();
                    if (mOpt == null || mOpt.size() == 0) {
                        return;
                    }
                    mOpt = response.body().getData();
                    mOpt1.clear();
                    mOpt1.addAll(mOpt);
                    mOpt2.clear();
                    for (PickSelectEntity<List<PickSelectEntity>> provinceDatum : mOpt) {
                        List<PickSelectEntity> children = provinceDatum.getChildren();
                        mOpt2.add(children);
                    }
                    if (isShow) {
                        showAddressPop();
                    }
                } else {
                    MToast.showToast(mActivity, response.body().getMsg());
                }
            }

            @Override
            public void onFailure(@NotNull Call<BaseEntity<List<PickSelectEntity<List<PickSelectEntity>>>>> call, @NotNull Throwable t) {
                DialogHelper.dismissProgressDialog();
                MLog.d(AppConstant.API_LOG, "error " + t.getMessage());
            }
        });
    }

    public void getCustomerData(boolean isShow) {
        DialogHelper.showProgressDialog(mActivity, null, "数据加载中...", 0, false, null).setCanceledOnTouchOutside(false);
        APIManager.getInstance().getMachineAPI().getCustomerOrg().enqueue(new Callback<BaseEntity<List<ServiceEntity>>>() {
            @Override
            public void onResponse(@NotNull Call<BaseEntity<List<ServiceEntity>>> call, @NotNull Response<BaseEntity<List<ServiceEntity>>> response) {
                DialogHelper.dismissProgressDialog();
                if (response.body() == null || response.body().getState() == null) {
                    return;
                }
                if (response.body().getState().equals(AppConstant.REQEUST_SECCUESS)) {
                    List<ServiceEntity> data = response.body().getData();
                    if (data == null || data.size() == 0) {
                        return;
                    }
                    mServiceList = new ArrayList<>();
                    for (int i = 0; i < data.size(); i++) {
                        PickSelectEntity pickSelectEntity = new PickSelectEntity();
                        pickSelectEntity.setNo(data.get(i).getId());
                        pickSelectEntity.setProjectscale(data.get(i).getName());
                        mServiceList.add(pickSelectEntity);
                    }
                    if (isShow) {
                        showCustomerPop();
                    }
                }
            }

            @Override
            public void onFailure(@NotNull Call<BaseEntity<List<ServiceEntity>>> call, @NotNull Throwable t) {
                DialogHelper.dismissProgressDialog();
            }
        });
    }

    public void showAddressPop() {
        if (mOpt1.size() == 0) {
            getCityData(true);
            return;
        }
        if (mCityOptions == null) {
            mCityOptions = new OptionsPickerBuilder(mActivity, (options1, options2, options3, v) -> {
                opt1 = options1;
                opt2 = options2;
            }).build();
            mCityOptions.setTitleText("选择城市");
        }
        mCityOptions.setPicker(mOpt1, mOpt2);
        mCityOptions.setSelectOptions(opt1, opt2);
        mCityOptions.show();
    }

    /**
     * 获取经纬度信息
     *
     * @param no
     * @param cityNo
     * @param areaNo
     */
    public void getLocationLL(String no, String cityNo, String areaNo) {
        DialogHelper.showProgressDialog(mActivity, null, "数据获取中...", 0, false, null).setCanceledOnTouchOutside(false);
        APIManager.getInstance().getDriverAPI().getLocationLL(mRepertory.getAreaCode(), no, cityNo, areaNo).enqueue(new Callback<BaseEntity<MapLongAndLatEntity>>() {
            @Override
            public void onResponse(@NotNull Call<BaseEntity<MapLongAndLatEntity>> call, @NotNull Response<BaseEntity<MapLongAndLatEntity>> response) {
                DialogHelper.dismissProgressDialog();
                if (response.body() == null) {
                    return;
                }
                if (response.body().getState().equals(APIManager.RESPONSE_OK)) {
                    mActivity.updateAddress(response.body().getData());
                } else {
                    MToast.showToast(mActivity.getActivity(), response.message());
                }
            }

            @Override
            public void onFailure(@NotNull Call<BaseEntity<MapLongAndLatEntity>> call, @NotNull Throwable t) {
                DialogHelper.dismissProgressDialog();
                MToast.showToast(mActivity.getActivity(), t.getMessage());
            }
        });

    }

    public void getAddressModel(int type) {
        DialogHelper.showProgressDialog(mActivity, null, "数据加载中...", 0, false, null).setCanceledOnTouchOutside(false);
        APIManager.getInstance().getGoodsAPI().getCityList().enqueue(new Callback<BaseEntity<List<AddressEntity<List<AddressEntity<List<AddressEntity>>>>>>>() {
            @Override
            public void onResponse(@NotNull Call<BaseEntity<List<AddressEntity<List<AddressEntity<List<AddressEntity>>>>>>> call, @NotNull Response<BaseEntity<List<AddressEntity<List<AddressEntity<List<AddressEntity>>>>>>> response) {
                DialogHelper.dismissProgressDialog();
                if ("200".equals(response.body().getCode())) {
                    mActivity.showAddressPop(response.body().getData(), type);
                }
            }

            @Override
            public void onFailure(@NotNull Call<BaseEntity<List<AddressEntity<List<AddressEntity<List<AddressEntity>>>>>>> call, @NotNull Throwable t) {
                DialogHelper.dismissProgressDialog();
                MLog.d(AppConstant.API_LOG, "error " + t.getMessage());
            }
        });
    }

    /**
     * 咨询客服
     */
    public void showCustomerPop() {
        if (mServiceList == null || mServiceList.size() == 0) {
            getCustomerData(true);
            return;
        }
        mCustomerOptions = new OptionsPickerBuilder(mActivity, (options1, options2, options3, v) -> mActivity.updateCustomer(mServiceList.get(options1))).setCancelColor(ContextCompat.getColor(mActivity, R.color.color_666666)).setTitleColor(ContextCompat.getColor(mActivity, R.color.color_969696)).build();
        mCustomerOptions.setTitleText("选择咨询客服");
        mCustomerOptions.setPicker(mServiceList);
        mCustomerOptions.setSelectOptions(0);
        mCustomerOptions.show();
    }

    /**
     * 工队类型
     */
    public void showTeamTypePop() {
        if (mTeamTypeList == null || mTeamTypeList.size() == 0) {
            mTeamTypeList = new ArrayList<>();
            mTeamTypeList.add(new PickSelectEntity("1", mActivity.getResources().getString(R.string.ti_team_type_1)));
            mTeamTypeList.add(new PickSelectEntity("0", mActivity.getResources().getString(R.string.ti_team_type_0)));
        }
        OptionsPickerView businessOption = new OptionsPickerBuilder(mActivity, (options1, options2, options3, v) -> {
            mActivity.updateTeamType(mTeamTypeList.get(options1));
            gdType = options1;
        }).setTitleText("选择工队类型").setCancelColor(ContextCompat.getColor(mActivity, R.color.color_666666)).setTitleColor(ContextCompat.getColor(mActivity, R.color.color_969696)).build();
        businessOption.setPicker(mTeamTypeList);
        businessOption.setSelectOptions(gdType);
        businessOption.show();
    }

    public void release() {
        if (mCityOptions != null) {
            mCityOptions.dismiss();
            mCityOptions = null;
        }
        if (mCustomerOptions != null) {
            mCustomerOptions.dismiss();
            mCustomerOptions = null;
        }
        if (mTeamTypeOptions != null) {
            mTeamTypeOptions.dismiss();
            mTeamTypeOptions = null;
        }
    }

    /**
     * 获取工队详情
     *
     * @param no 工队详情获取的no
     */
    public void getTeamIntroduceData(String no) {
        Map<String, Object> map = new HashMap<>();
        map.put("no", no);
        DialogHelper.showProgressDialog(mActivity, null, "数据加载中...", 0, false, null).setCanceledOnTouchOutside(false);
        NewAPIManager.getInstance().getTeamNewInterfaceAPI().getTeamInfo(map).enqueue(new Callback<BaseEntity<SelfTeamIntroduceEntity>>() {
            @Override
            public void onResponse(@NotNull Call<BaseEntity<SelfTeamIntroduceEntity>> call, @NotNull Response<BaseEntity<SelfTeamIntroduceEntity>> response) {
                DialogHelper.dismissProgressDialog();
                if (response.body() == null || response.body().getState() == null) {
                    return;
                }
                if (response.body().getState().equals(APIManager.RESPONSE_OK)) {
                    mActivity.setTeamIntroduceData(response.body().getData());
                }
            }

            @Override
            public void onFailure(@NotNull Call<BaseEntity<SelfTeamIntroduceEntity>> call, @NotNull Throwable t) {
                DialogHelper.dismissProgressDialog();
            }
        });
    }

    /**
     * 跳转到h5详情
     *
     * @param no h5详情的no
     */
    public void TeamParticulars(String no) {
        APIManager.getInstance().getPickAPI().getUrlSetting("teamWorkDetail").enqueue(new ICallBack<BaseEntity<H5ReEntity>>() {
            @Override
            public void onSuccess(BaseEntity<H5ReEntity> data) {
                if (data.getState().equals(APIManager.RESPONSE_OK)) {
                    //参数1:type(0:	前台,1:用户中心);	参数2:no
                    String url = data.getData().getUrl() + "?no=" + no + "&type=1";
                    mActivity.setUrlView(url);
                }
            }
        });
    }

    /**
     * 民族
     */
    public void getNationList() {
        DialogHelper.showProgressDialog(mActivity, null, "数据加载中", 0, true, null).setCanceledOnTouchOutside(false);
        NewAPIManager.getInstance().getTeamNewInterfaceAPI().getNationRecord().enqueue(new Callback<BaseEntity<List<PickSelectEntity>>>() {
            @Override
            public void onResponse(@NotNull Call<BaseEntity<List<PickSelectEntity>>> call, @NotNull Response<BaseEntity<List<PickSelectEntity>>> response) {
                DialogHelper.dismissProgressDialog();
                if (response.body() == null || response.body().getState() == null) {
                    return;
                }
                if (response.body().getState().equals(APIManager.RESPONSE_OK)) {
                    mActivity.setNationData(response.body().getData());
                }
            }

            @Override
            public void onFailure(@NotNull Call<BaseEntity<List<PickSelectEntity>>> call, @NotNull Throwable t) {
                DialogHelper.dismissProgressDialog();
            }
        });
    }

    /**
     * 性别
     *
     * @return 性别的列表
     */
    public List<PickSelectEntity> getSex() {
        List<PickSelectEntity> list = new ArrayList<>();
        PickSelectEntity entity1 = new PickSelectEntity();
        entity1.setNo("0");
        entity1.setProjectscale("男");
        PickSelectEntity entity2 = new PickSelectEntity();
        entity2.setNo("1");
        entity2.setProjectscale("女");
        list.add(entity1);
        list.add(entity2);
        return list;
    }

    public List<PickSelectEntity> getTeam() {
        List<PickSelectEntity> list = new ArrayList<>();
        PickSelectEntity entity1 = new PickSelectEntity();
        entity1.setNo("0");
        entity1.setProjectscale("0-10人");
        PickSelectEntity entity2 = new PickSelectEntity();
        entity2.setNo("1");
        entity2.setProjectscale("11-20人");
        PickSelectEntity entity3 = new PickSelectEntity();
        entity3.setNo("2");
        entity3.setProjectscale("21-50人");
        PickSelectEntity entity4 = new PickSelectEntity();
        entity4.setNo("3");
        entity4.setProjectscale("51-100人");
        PickSelectEntity entity5 = new PickSelectEntity();
        entity5.setNo("4");
        entity5.setProjectscale("100人以上");
        list.add(entity1);
        list.add(entity2);
        list.add(entity3);
        list.add(entity4);
        list.add(entity5);
        return list;
    }

    public void getCategoryData(String cid, View view) {
        Call<BaseEntity<List<PickSelectEntity>>> call;
        if (mPopWindow == null) {
            DialogHelper.showProgressDialog(mActivity, null, "数据加载中...", 0, false, null).setCanceledOnTouchOutside(false);
            call = NewAPIManager.getInstance().getTeamNewInterfaceAPI().getCategoryList();
        } else {
            call = NewAPIManager.getInstance().getTeamNewInterfaceAPI().getSecondCategory(cid);
        }
        call.enqueue(new Callback<BaseEntity<List<PickSelectEntity>>>() {
            @Override
            public void onResponse(@NotNull Call<BaseEntity<List<PickSelectEntity>>> call, @NotNull Response<BaseEntity<List<PickSelectEntity>>> response) {
                DialogHelper.dismissProgressDialog();
                if (response.body() == null || response.body().getState() == null) {
                    return;
                }
                if (response.body().getState().equals(APIManager.RESPONSE_OK)) {
                    updateData(response.body().getData(), view);
                }
            }

            @Override
            public void onFailure(@NotNull Call<BaseEntity<List<PickSelectEntity>>> call, @NotNull Throwable t) {
                DialogHelper.dismissProgressDialog();
            }
        });
    }

    private void updateData(List<PickSelectEntity> data, View view) {
        if (mPopWindow == null) {
            //初始化筛选
            mPopWindow = new TeamMultiPopWindow(mActivity, 3);
            mPopWindow.setName1("工程专业");
            mPopWindow.setFilterResultClick(this);
            mPopWindow.onItemClick(this);
        }

        if (data == null || data.size() <= 0) {
            switch (mPopWindow.getType()) {
                case TeamMultiPopWindow.TYPE_TWO:
                    mPopWindow.setMaxNumber(1);
                    break;
                case TeamMultiPopWindow.TYPE_THR:
                    mPopWindow.setMaxNumber(2);
                    break;
                default:
                    break;
            }
            return;
        }

        mPopWindow.setMaxNumber(3);

        switch (mPopWindow.getType()) {
            case TeamMultiPopWindow.TYPE_DEFAULT:
                mPopWindow.setData1(data);
                break;
            case TeamMultiPopWindow.TYPE_TWO:
                mPopWindow.setData2(data);
                break;
            case TeamMultiPopWindow.TYPE_THR:
                mPopWindow.setData3(data);
                break;
            case TeamMultiPopWindow.TYPE_FOU:
                mPopWindow.setData4(data);
                break;
            case TeamMultiPopWindow.TYPE_FIV:
                mPopWindow.setData5(data);
                break;
            case TeamMultiPopWindow.TYPE_SIX:
                mPopWindow.setData6(data);
                break;
            default:
                break;
        }
        if (view != null) {
            showPop(view);
        }
    }

    @Override
    public void result(PickSelectEntity... entity) {
        if (entity == null || entity.length == 0) {
            return;
        }
        List<String> noBuilder = new ArrayList<>();
        StringBuilder cNameBuilder = new StringBuilder();

        for (int i = 0; i < entity.length; i++) {
            noBuilder.add(entity[i].getNo());
            switch (i) {
                case 0:
                case 1:
                case 2:
                case 3:
                case 4:
                case 5:
                    cNameBuilder.append("|").append(entity[i].getProjectscale());
                    break;
                default:
                    break;
            }
        }

        if (cNameBuilder.length() > 0) {
            cNameBuilder.delete(0, 1);
        }

        mActivity.showData(cNameBuilder.toString(), noBuilder, cNameBuilder.toString());
    }

    @Override
    public void itemClick(String no, int position, String name) {
        getCategoryData(no, null);
    }

    public void showPop(View view) {
        if (mPopWindow == null) {
            getCategoryData("", view);
        } else {
            if (!mPopWindow.isShowing()) {
                mPopWindow.showAtLocation(view, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
            }
        }
    }

    public void companyInfo(String cid) {
        DialogHelper.showProgressDialog(mActivity, null, "数据加载中", 0, true, null).setCanceledOnTouchOutside(false);
        NewAPIManager.getInstance().getTeamNewInterfaceAPI().companyInfo(cid).enqueue(new ICallBack<BaseEntity<BuildCompanyInfoEntity>>() {
            @Override
            public void onSuccess(BaseEntity<BuildCompanyInfoEntity> data) {
                mActivity.companyInfo(data.getData());
            }
        });
    }
}
